package com.google.code.openperfmon.web.admin;

import java.util.List;

import com.google.code.openperfmon.domain.Host;
import com.google.code.openperfmon.service.AdminEntityInfo;
import com.google.code.openperfmon.service.ServiceFactory;
import com.opensymphony.xwork2.ActionSupport;

@SuppressWarnings("serial")
public class ManageHostsAction extends ActionSupport {	 
	private Long id;
	private List<AdminEntityInfo<Host>> hosts;
	
	public List<AdminEntityInfo<Host>> getHosts() {
		return hosts;
	}

	public String list() throws Exception {
		hosts = ServiceFactory.getHostService().listHosts(); 
		return SUCCESS;
	}

	public String delete() throws Exception {
		ServiceFactory.getHostService().deleteHost(id);
		return SUCCESS;
	}
	

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}
}
